package no.hio.wsprovider.vo;
//Class StockItem
//Representerer lagerbeholdning/plassering
/**
 * 
 * Represents stocklocation and -number for a product
 * 
 * @version 1.0 
 * @author Andreas Heim and Henning Gundersen
 * 
 *  
 */
public class StockItem
{

	private int productID;
	private int numInStock;
	private String stockLocation = "";
	
	/**
	 * @return the productID
	 */
	public int getProductID() {
		return productID;
	}
	/**
	 * @param productID the productID to set
	 */
	public void setProductID(int productID) {
		this.productID = productID;
	}
	/**
	 * @return the numInStock
	 */
	public int getNumInStock() {
		return numInStock;
	}
	/**
	 * @param numInStock the numInStock to set
	 */
	public void setNumInStock(int numInStock) {
		this.numInStock = numInStock;
	}
	/**
	 * @return the stockLocation
	 */
	public String getStockLocation() {
		return stockLocation;
	}
	/**
	 * @param stockLocation the stockLocation to set
	 */
	public void setStockLocation(String stockLocation) {
		this.stockLocation = stockLocation;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		//simple equals implementation.
		if(obj == this) return true;
		if(!(obj instanceof StockItem)) return false;
		
		StockItem comp = (StockItem) obj;
				 
		if(comp.getProductID() != this.getProductID()) return false;
		if(comp.getNumInStock() != this.getNumInStock()) return false;
		if(!comp.getStockLocation().equals(this.getStockLocation())) return false;

		return true;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#clone()
	 */
	@Override
	public Object clone() {
		
		StockItem copy = new StockItem();
		
		copy.productID = this.productID;
		copy.numInStock = this.numInStock;
		copy.stockLocation = this.stockLocation;
		return copy;
	}
	
	public String toString()
	{
		StringBuffer retVal = new StringBuffer();
		
		retVal.append("ProductID: ");
		retVal.append(productID);
		retVal.append(" NumInStock: ");
		retVal.append(numInStock);
		retVal.append(" StockLocation: ");
		retVal.append(stockLocation);
		
		return retVal.toString();
	}
	
	
}
